package com.elrichuang.userserver.client;

import com.elrichuang.terminator.tri.product.ProductReply;
import com.elrichuang.terminator.tri.product.ProductRequest;
import com.elrichuang.terminator.tri.product.ProductServer;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class ProductClient {
    @DubboReference
    private ProductServer productServer;

    public String sayHello(String name) {
        ProductRequest productRequest = ProductRequest.newBuilder().setName(name).build();
        ProductReply reply = productServer.sayHello(productRequest);

        return reply.getMessage();
    }
}
